835A - Key races - CodeForces Solution


math *800

Please click on ads to support us..

Python Code:

s, v1, v2, t1, t2 = map(int, input().split())
c1 = (s * v1) + t1 * 2
c2 = (s * v2) + t2 * 2
if c1 < c2:
    print('First')
elif c2 < c1:
    print('Second')
else:
    print('Friendship')

C++ Code:

	#include <bits/stdc++.h>
	#define ll long long
	#define fast()  ios_base::sync_with_stdio (false); cin.tie (0); cout.tie (0);
	#define run() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	#define st string
	#define forx for (ll i = 0; i < x; i++)
	#define fork for (ll i = 0; i < k; i++)
	#define fory for (ll i = 0; i < y; i++)
	#define wh while
	#define ms multiset
	#define rs reverse
	#define ss stringstream
	#define dbl double
	#define fors for(ll i = 0; i < s.size();i++)
	#define forn for(ll i = 0; i < n;i++)
	#define form for(ll j = 0; j <= m;j++)
	#define pb push_back 
	#define rt0 return 0;
	const int Max = 1e9;
	#pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
	#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
	#pragma GCC optimize("Ofast")
	#pragma GCC target("avx,avx2,fma")
	#pragma GCC optimization("unroll-loops")
	#pragma ("reroll")
	const int N = 1e5 + 1;
	ll n,m,a[N], cnt = 0, mx = Max, mn = Max;
	using namespace std;
	int main()
	{
	 run()
	 fast()
	 ll s,v1,v2,t1,t2;
	 cin>>s>>v1>>v2>>t1>>t2;
	 if((s*v1)+(t1*2) < (s*v2)+(t2*2)){
	     cout<<"First";
	 }
	 else if((s*v1)+(t1*2) > (s*v2)+(t2*2)){
	     cout<<"Second";
	 }
	 else cout<<"Friendship";
	}


Comments

Submit
0 Comments
More Questions

507B - Amr and Pins
379A - New Year Candles
1154A - Restoring Three Numbers
750A - New Year and Hurry
705A - Hulk
492B - Vanya and Lanterns
1374C - Move Brackets
1476A - K-divisible Sum
1333A - Little Artem
432D - Prefixes and Suffixes
486A - Calculating Function
1373B - 01 Game
1187A - Stickers and Toys
313B - Ilya and Queries
579A - Raising Bacteria
723A - The New Year Meeting Friends
302A - Eugeny and Array
1638B - Odd Swap Sort
1370C - Number Game
1206B - Make Product Equal One
131A - cAPS lOCK
1635A - Min Or Sum
474A - Keyboard
1343A - Candies
1343C - Alternating Subsequence
1325A - EhAb AnD gCd
746A - Compote
318A - Even Odds
550B - Preparing Olympiad
939B - Hamster Farm